home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / obrn-a_1.5_lib.lha / oberon-a / source2.lha / Source / 3rdParty / ARP.mod < prev    next >
Encoding:
Text File  |  1995-01-26  |  58.2 KB  |  1,451 lines

  1. (*************************************************************************
  2.  
  3.      $RCSfile: ARP.mod $
  4.   Description: Interface to arp.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 2.10 $
  8.       $Author: fjc $
  9.         $Date: 1995/01/26 00:24:50 $
  10.  
  11.   Copyright © 1994-1995, Frank Copeland.
  12.   This file is part of the Oberon-A Library.
  13.   See Oberon-A.doc for conditions of use and distribution.
  14.  
  15. *************************************************************************)
  16.  
  17. <* STANDARD- *> <* INITIALISE- *> <* MAIN- *>
  18. <*$ CaseChk-  IndexChk- LongVars+ NilChk-  *>
  19. <*$ RangeChk- StackChk- TypeChk-  OvflChk- *>
  20.  
  21. MODULE [2] ARP;
  22.  
  23. (*
  24.  ************************************************************************
  25.  *                                                                      *
  26.  * 5/3/89       ARPbase.h       by MKSoft from ARPbase.i by SDB         *
  27.  *                                                                      *
  28.  ************************************************************************
  29.  *                                                                      *
  30.  *      AmigaDOS Resource Project -- Library Include File               *
  31.  *                                   for Lattice C 5.x or Manx C 5.x    *
  32.  *                                                                      *
  33.  ************************************************************************
  34.  *                                                                      *
  35.  *      Copyright (c) 1987/1988/1989 by Scott Ballantyne                *
  36.  *                                                                      *
  37.  *      The arp.library, and related code and files may be freely used  *
  38.  *      by supporters of ARP.  Modules in the arp.library may not be    *
  39.  *      extracted for use in independent code, but you are welcome to   *
  40.  *      provide the arp.library with your work and call on it freely.   *
  41.  *                                                                      *
  42.  *      You are equally welcome to add new functions, improve the ones  *
  43.  *      within, or suggest additions.                                   *
  44.  *                                                                      *
  45.  *      BCPL programs are not welcome to call on the arp.library.       *
  46.  *      The welcome mat is out to all others.                           *
  47.  *                                                                      *
  48.  ************************************************************************
  49.  *                                                                      *
  50.  * N O T E !  You MUST! have IoErr() defined as LONG to use LastTracker *
  51.  *            If your compiler has other defines for this, you may wish *
  52.  *            to remove the prototype for IoErr() from this file.       *
  53.  *                                                                      *
  54.  ************************************************************************
  55.  *)
  56.  
  57. (*
  58.  ************************************************************************
  59.  *      First we need to include the Amiga Standard Include files...    *
  60.  ************************************************************************
  61.  *)
  62.  
  63.  
  64. IMPORT
  65.   SYS := SYSTEM, Kernel,
  66.   e := Exec, d := Dos, g := Graphics, i := Intuition, s := Sets;
  67.  
  68. (* All pointers are declared first for convenience *)
  69.  
  70. TYPE
  71.  
  72.   ArpBasePtr *             = POINTER TO ArpBase;
  73.   EnvBasePtr *             = POINTER TO EnvBase;
  74.   FileRequesterPtr *       = POINTER TO FileRequester;
  75.   AnchorPathPtr *          = POINTER TO AnchorPath;
  76.   AChainPtr *              = POINTER TO AChain;
  77.   DirectoryEntryPtr *      = POINTER TO DirectoryEntry;
  78.   TrackedResourcePtr *     = POINTER TO TrackedResource;
  79.   DefaultTrackerPtr *      = POINTER TO DefaultTracker;
  80.   ResListPtr *             = POINTER TO ResList;
  81.   ZombieMsgPtr *           = POINTER TO ZombieMsg;
  82.   ProcessControlBlockPtr * = POINTER TO ProcessControlBlock;
  83.   NewShellPtr *            = POINTER TO NewShell;
  84.   ResidentProgramNodePtr * = POINTER TO ResidentProgramNode;
  85.   ResidentProgramTagPtr *  = POINTER TO ResidentProgramTag;
  86.   ProcessMemoryPtr *       = POINTER TO ProcessMemory;
  87.   DateTimePtr *            = POINTER TO DateTime;
  88.  
  89.  
  90. CONST
  91.  
  92. (*
  93.  ************************************************************************
  94.  *      Standard definitions for arp library information                *
  95.  ************************************************************************
  96.  *)
  97.  
  98.   arpName *    = "arp.library";   (* Name of library... *)
  99.   arpVersion * = 39;              (* Current version... *)
  100.  
  101. TYPE
  102.  
  103. (*
  104.  ************************************************************************
  105.  *      The current ARP library node...                                 *
  106.  ************************************************************************
  107.  *)
  108.  
  109.   ArpBase * = RECORD (e.LibraryBase)
  110.     libNode *      : e.Library;     (* Standard library node               *)
  111.     dosRootNode *  : d.RootNodePtr; (* Copy of dlRoot                      *)
  112.     abFlags *      : s.SET8;        (* See bitdefs below                   *)
  113.     escChar *      : CHAR;          (* Character to be used for escaping   *)
  114.     arpReserved1 * : LONGINT;       (* ArpLib's use only!!                 *)
  115.     envBase *      : e.LibraryPtr;  (* Dummy library for MANX compatibility*)
  116.     dosBase *      : d.DosLibraryPtr;(* Cached DosBase                      *)
  117.     gfxBase *      : g.GfxBasePtr;  (* Cached GfxBase                      *)
  118.     intuiBase *    : i.IntuitionBasePtr;(* Cached IntuitionBase                *)
  119.     resLists *     : e.MinList;     (* Resource trackers                   *)
  120.     residentPrgList * : ResidentProgramNodePtr; (* Resident Programs.        *)
  121.     resPrgProtection * : e.SignalSemaphore; (* protection for above       *)
  122.     segList *      : e.BPTR;        (* Pointer to loaded libcode (a BPTR). *)
  123.   END; (* ArpBase *)
  124.  
  125. TYPE
  126.  
  127. (*
  128.  ***********************************"*"**********************************
  129.  *      The following is here *ONLY* for information and for            *
  130.  *      compatibility with MANX.  DO NOT use in new code!               *
  131.  ************************************************************************
  132.  *)
  133.  
  134.   EnvBase * = RECORD
  135.     libNode *  : e.Library;  (* Standard library node for linkage    *)
  136.     envSpace * : e.ADDRESS;  (* Access only when Forbidden!          *)
  137.     envSize *  : e.ULONG;    (* Total allocated mem for EnvSpace     *)
  138.     arpBase *  : ArpBasePtr; (* Added in V32 for Resource Tracking   *)
  139.   END; (* EnvBase *)
  140.  
  141.  
  142. CONST
  143.  
  144. (*
  145.  ************************************************************************
  146.  *      These are used in release 33.4 but not by the library code.     *
  147.  *      Instead, individual programs check for these flags.             *
  148.  ************************************************************************
  149.  *)
  150.  
  151.   arpWildWorld * = 0;              (* Mixed BCPL/Normal wildcards. *)
  152.   arpWildBCPL  * = 1;              (* Pure BCPL wildcards.         *)
  153.  
  154.  
  155. CONST
  156.  
  157. (*
  158.  ************************************************************************
  159.  * The alert object is what you use if you really must return an alert  *
  160.  * to the user. You would normally OR this with another alert number    *
  161.  * from the alerts.h file. Generally, should be NON deadend alerts.     *
  162.  *                                                                      *
  163.  * For example, if you can't open ArpLibrary:                           *
  164.  *      Alert( (AgOpenLib|AoArpLib), 0L);                               *
  165.  ************************************************************************
  166.  *)
  167.  
  168.   aoArpLib       * = 00008036H;             (* Alert object *)
  169.  
  170. CONST
  171.  
  172. (*
  173.  ************************************************************************
  174.  *      Alerts that arp.library may return...                           *
  175.  ************************************************************************
  176.  *)
  177.  
  178.   anArpLib       * = 03600000H;   (* Alert number                         *)
  179.   anArpNoMem     * = 03610000H;   (* No more memory                       *)
  180.   anArpInputMem  * = 03610002H;   (* No memory for input buffer           *)
  181.   anArpNoMakeEnv * = 83610003H;   (* No memory to make EnvLib             *)
  182.  
  183.   anArpNoDOS     * = 83630001H;   (* Can't open dos.library               *)
  184.   anArpNoGfx     * = 83630002H;   (* Can't open graphics.library          *)
  185.   anArpNoIntuit  * = 83630003H;   (* Can't open intuition                 *)
  186.   anBadPackBlues * = 83640000H;   (* Bad packet returned to SendPacket()  *)
  187.   anZombie       * = 83600003H;   (* Zombie roaming around system         *)
  188.  
  189.   anArpScattered * = 83600002H;   (* Scatter loading not allowed for arp  *)
  190.  
  191.  
  192. CONST
  193.  
  194. (*
  195.  ************************************************************************
  196.  *      Return codes you can get from calling ARP Assign()...           *
  197.  ************************************************************************
  198.  *)
  199.  
  200.   assignOK       * = 0; (* Everything is cool and groovey                *)
  201.   assignNODEV    * = 1; (* "Physical" is not valid for assignment        *)
  202.   assignFATAL    * = 2; (* Something really icky happened                *)
  203.   assignCANCEL   * = 3; (* Tried to cancel something but it won't cancel *)
  204.  
  205. CONST
  206.  
  207. (*
  208.  ************************************************************************
  209.  *      Size of buffer you need if you are going to call ReadLine()     *
  210.  ************************************************************************
  211.  *)
  212.  
  213.   maxInputBuf     * = 256;
  214.  
  215. TYPE
  216.  
  217. (*
  218.  ************************************************************************
  219.  *      The ARP file requester data structure...                        *
  220.  ************************************************************************
  221.  *)
  222.  
  223.  
  224.   FileRequester * = RECORD
  225.     hail *      : e.ADDRESS;   (* Hailing text                 *)
  226.     file *      : e.ADDRESS;   (* Filename array (FCHARS + 1)  *)
  227.     dir *       : e.ADDRESS;   (* Directory array (DSIZE + 1)  *)
  228.     window *    : i.WindowPtr; (* Window requesting or NULL    *)
  229.     funcFlags * : s.SET8;      (* Set bitdef's below           *)
  230.     flags2 *    : s.SET8;      (* New flags...                 *)
  231.     function *  : PROCEDURE(); (* Your function, see bitdef's  *)
  232.     leftEdge *  : INTEGER;     (* To be used later...          *)
  233.     topEdge *   : INTEGER;
  234.   END; (* FileRequester *)
  235.  
  236.  
  237. CONST
  238.  
  239. (*
  240.  ************************************************************************
  241.  * The following are the defines for frFuncFlags.  These bits tell      *
  242.  * FileRequest() what your frUserFunc is expecting, and what            *
  243.  * FileRequest() should call it for.                                    *
  244.  *                                                                      *
  245.  * You are called like so:                                              *
  246.  * frFunction(Mask, Object)                                             *
  247.  * e.ULONG        Mask;                                                 *
  248.  * e.APTR         *Object;                                              *
  249.  *                                                                      *
  250.  * The Mask is a copy of the flag value that caused FileRequest() to    *
  251.  * call your function. You can use this to determine what action you    *
  252.  * need to perform, and exactly what Object is, so you know what to do  *
  253.  * and what to return.                                                  *
  254.  ************************************************************************
  255.  *)
  256.  
  257.   doWildFunc  * = 7; (* Call me with a FIB and a name, ZERO return accepts.       *)
  258.   doMsgFunc   * = 6; (* You get all IDCMP messages not for FileRequest()          *)
  259.   doColor     * = 5; (* Set this bit for that new and different look              *)
  260.   newIDCMP    * = 4; (* Force a new IDCMP (only if frWindow != NULL)             *)
  261.   newWindFunc * = 3; (* You get to modify the newwindow structure.                *)
  262.   addGadFunc  * = 2; (* You get to add gadgets.                                   *)
  263.   gEventFunc  * = 1; (* Function to call if one of your gadgets is selected.      *)
  264.   listFunc    * = 0; (* Not implemented yet.                                      *)
  265.  
  266.  
  267. CONST
  268.  
  269. (*
  270.  ************************************************************************
  271.  * The FR2 bits are for frFlags2 in the file requester structure     *
  272.  ************************************************************************
  273.  *)
  274.  
  275.   longPath   * = 0; (* Specify the frDir buffer is 256 bytes long *)
  276.  
  277.  
  278. CONST
  279.  
  280. (*
  281.  ************************************************************************
  282.  *      The sizes of the different buffers...                           *
  283.  ************************************************************************
  284.  *)
  285.  
  286.   fChars * = 32;     (* Filename size                              *)
  287.   dSize *  = 33;     (* Directory name size if not FR2LongPath     *)
  288.  
  289.   longDSize * = 254;    (* If FR2LongPath is set, use longDSIZE    *)
  290.   longFSize * = 126;    (* For compatibility with ARPbase.i        *)
  291.  
  292.   firstGadget * = 7680H; (* User gadgetID's must be less than this value *)
  293.  
  294.  
  295. TYPE
  296.  
  297. (*
  298.  ************************************************************************
  299.  * Structure expected by FindFirst()/FindNext()                         *
  300.  *                                                                      *
  301.  * You need to allocate this structure and initialize it as follows:    *
  302.  *                                                                      *
  303.  * Set apBreakBits to the signal bits (CDEF) that you want to take a    *
  304.  * break on, or NULL, if you don't want to convenience the user.        *
  305.  *                                                                      *
  306.  * if you want to have the FULL PATH NAME of the files you found,       *
  307.  * allocate a buffer at the END of this structure, and put the size of  *
  308.  * it into apStrLen.  If you don't want the full path name, make sure   *
  309.  * you set apStrLen to zero.  In this case, the name of the file, and   *
  310.  * stats are available in the apInfo, as per usual.                     *
  311.  *                                                                      *
  312.  * Then call FindFirst() and then afterwards, FindNext() with this      *
  313.  * structure.  You should check the return value each time (see below)  *
  314.  * and take the appropriate action, ultimately calling                  *
  315.  * FreeAnchorChain() when there are no more files and you are done.     *
  316.  * You can tell when you are done by checking for the normal AmigaDOS   *
  317.  * return code errorNoMoreENTRIES.                                      *
  318.  *                                                                      *
  319.  * You will also have to check the DirEntryType variable in the apInfo  *
  320.  * structure to determine what exactly you have received.               *
  321.  ************************************************************************
  322.  *)
  323.  
  324.   AnchorPath * = RECORD
  325.     base *       : AChainPtr; (* Pointer to first anchor                *)
  326.     last *       : AChainPtr; (* Pointer to last anchor                 *)
  327.     breakBits *  : s.SET32;   (* Bits to break on                       *)
  328.     foundBreak * : s.SET32;   (* Bits we broke on. Also returns ERROR_BREAK *)
  329.     flags *      : s.SET8;    (* New use for the extra word...          *)
  330.     reserved *   : SYS.BYTE;  (* To fill it out...                      *)
  331.     strLen *     : INTEGER;   (* This is what used to be apLength       *)
  332.     info *       : d.FileInfoBlock;
  333.   (*buf *        : ARRAY OF SYS.BYTE; (* Allocate a buffer here, if desired *)*)
  334.   END; (* AnchorPath *)
  335.  
  336. CONST
  337.  
  338. (*
  339.  ************************************************************************
  340.  *      Bit definitions for the new apFlags...                         *
  341.  ************************************************************************
  342.  *)
  343.  
  344.   doWild      * = 0;    (* User option ALL                              *)
  345.   itsWild     * = 1;    (* Set by FindFirst, used by FindNext           *)
  346.   doDir       * = 2;    (* Bit is SET if a DIR node should be entered   *)
  347.                         (* Application can RESET this bit po AVOID      *)
  348.                         (* entering a dir.                              *)
  349.   didDir      * = 3;    (* Bit is set for an "expired" dir node         *)
  350.   noMemErr    * = 4;    (* Set if there was not enough memory           *)
  351.   doDot       * = 5;    (* If set, '.' (DOT) will convert to CurrentDir *)
  352.  
  353.  
  354. TYPE
  355.  
  356. (*
  357.  ************************************************************************
  358.  * Structure used by the pattern matching functions, no need to obtain, *
  359.  * diddle or allocate this yourself.                                    *
  360.  *                                                                      *
  361.  * Note:  If you did, you will now break as it has changed...           *
  362.  ************************************************************************
  363.  *)
  364.  
  365.   AChain * = RECORD
  366.     child *  : AChainPtr;
  367.     parent * : AChainPtr;
  368.     lock *   : d.FileLockPtr;
  369.     info *   : d.FileInfoBlockPtr;
  370.     flags *  : s.SET8;
  371.     string * : ARRAY 1 OF CHAR;   (* Just as is .i file   *)
  372.   END; (* AChain *)               (* ???  Don't use this! *)
  373.  
  374. CONST
  375.  
  376.   patternBit  * = 0;
  377.   examinedBit * = 1;
  378.   completed   * = 2;
  379.   allBit      * = 3;
  380.  
  381.  
  382. CONST
  383.  
  384. (*
  385.  ************************************************************************
  386.  * Constants used by wildcard routines                                  *
  387.  *                                                                      *
  388.  * These are the pre-parsed tokens referred to by pattern match.  It    *
  389.  * is not necessary for you to do anything about these, FindFirst()     *
  390.  * FindNext() handle all these for you.                                 *
  391.  ************************************************************************
  392.  *)
  393.  
  394.   any           * = 80X;   (* Token for '*' | '#?' *)
  395.   single        * = 81X;   (* Token for '?'        *)
  396.  
  397. CONST
  398.  
  399. (*
  400.  ************************************************************************
  401.  * No need to muck with these as they may change...                     *
  402.  ************************************************************************
  403.  *)
  404.  
  405.   orStart       * = 82X;   (* Token for '('        *)
  406.   orNext        * = 83X;   (* Token for '|'        *)
  407.   OrEnd         * = 84X;   (* Token for ')'        *)
  408.   not           * = 85X;   (* Token for '~'        *)
  409.   notClass      * = 87X;   (* Token for '^'        *)
  410.   class         * = 88X;   (* Token for '[]'       *)
  411.   repBeg        * = 89X;   (* Token for '['        *)
  412.   repEnd        * = 8AX;   (* Token for ']'        *)
  413.  
  414.  
  415. TYPE
  416.  
  417. (*
  418.  ************************************************************************
  419.  * Structure used by AddDANode(), AddDADevs(), FreeDAList().            *
  420.  *                                                                      *
  421.  * This structure is used to create lists of names, which normally      *
  422.  * are devices, assigns, volumes, files, or directories.                *
  423.  ************************************************************************
  424.  *)
  425.  
  426.   DirectoryEntry * = RECORD
  427.     next *  : DirectoryEntryPtr; (* Next in list                      *)
  428.     type *  : SHORTINT;          (* dlxmumble                         *)
  429.     flags * : s.SET8;            (* For future expansion, DO NOT USE! *)
  430.     name *  : ARRAY 256 OF CHAR; (* The name of the thing found       *)
  431.   END; (* DirectoryEntry *)
  432.  
  433. CONST
  434.  
  435. (*
  436.  ************************************************************************
  437.  * Defines you use to get a list of the devices you want to look at.    *
  438.  * For example, to get a list of all directories and volumes, do:       *
  439.  *                                                                      *
  440.  *      AddDADevs( mydalist, (DlfDIRS | dlfVOLUMES) )                   *
  441.  *                                                                      *
  442.  * After this, you can examine the detype field of the elements added   *
  443.  * to your list (if any) to discover specifics about the objects added. *
  444.  *                                                                      *
  445.  * Note that if you want only devices which are also disks, you must    *
  446.  * (DlfDEVICES | dlfDISKONLY).                                          *
  447.  ************************************************************************
  448.  *)
  449.  
  450.   devices     * = 0;      (* Return devices                               *)
  451.   diskOnly    * = 1;      (* Modifier for above: Return disk devices only *)
  452.   volumes     * = 2;      (* Return volumes only                          *)
  453.   dirs        * = 3;      (* Return assigned devices only                 *)
  454.  
  455.  
  456. CONST
  457.  
  458. (*
  459.  ************************************************************************
  460.  * Legal deType values, check for these after a call to AddDADevs(),    *
  461.  * or use on your own as the ID values in AddDANode().                  *
  462.  ************************************************************************
  463.  *)
  464.  
  465.   file        * = 0;      (* AddDADevs() can't determine this     *)
  466.   dir         * = 8;      (* AddDADevs() can't determine this     *)
  467.   device      * = 16H;    (* It's a resident device               *)
  468.   volume      * = 24H;    (* Device is a volume                   *)
  469.   unmounted   * = 32H;    (* Device is not resident               *)
  470.   assign      * = 40H;    (* Device is a logical assignment       *)
  471.  
  472. (*
  473.  ************************************************************************
  474.  *      Resource Tracking stuff...                                      *
  475.  ************************************************************************
  476.  *                                                                      *
  477.  * There are a few things in arp.library that are only directly         *
  478.  * acessable from assembler.  The glue routines provided by us for      *
  479.  * all 'C' compilers use the following conventions to make these        *
  480.  * available to C programs.  The glue for other language's should use   *
  481.  * as similar a mechanism as possible, so that no matter what language  *
  482.  * or compiler we speak, when talk about arp, we will know what the     *
  483.  * other guy is saying.                                                 *
  484.  *                                                                      *
  485.  * Here are the cases:                                                  *
  486.  *                                                                      *
  487.  * Tracker calls...                                                     *
  488.  *              These calls return the Tracker pointer as a secondary   *
  489.  *              result in the register A1.  For C, there is no clean    *
  490.  *              way to return more than one result so the tracker       *
  491.  *              pointer is returned in IoErr().  For ease of use,       *
  492.  *              there is a define that typecasts IoErr() to the correct *
  493.  *              pointer type.  This is called LastTracker and should    *
  494.  *              be source compatible with the earlier method of storing *
  495.  *              the secondary result.                                   *
  496.  *                                                                      *
  497.  * GetTracker() -                                                       *
  498.  *              Syntax is a bit different for C than the assembly call  *
  499.  *              The C syntax is GetTracker(ID).  The binding routines   *
  500.  *              will store the ID into the tracker on return.  Also,    *
  501.  *              in an effort to remain consistant, the tracker will     *
  502.  *              also be stored in LastTracker.                          *
  503.  *                                                                      *
  504.  * In cases where you have allocated a tracker before you have obtained *
  505.  * a resource (usually the most efficient method), and the resource has *
  506.  * not been obtained, you will need to clear the tracker id.  The macro *
  507.  * clearID() has been provided for that purpose.  It expects a pointer *
  508.  * to a DefaultTracker sort of struct.                                  *
  509.  ************************************************************************
  510.  
  511. #define CLEAR_ID(t)     ((SHORT * ) t)[-1]* =NULL
  512.  
  513.  ************************************************************************
  514.  * You MUST prototype IoErr() to prevent the possible error in defining *
  515.  * IoErr() and thus causing LastTracker to give you trash...            *
  516.  *                                                                      *
  517.  * N O T E !  You MUST! have IoErr() defined as LONG to use LastTracker *
  518.  *            If your compiler has other defines for this, you may wish *
  519.  *            to remove the prototype for IoErr().                      *
  520.  ************************************************************************
  521.  
  522. #define LastTracker     ((struct DefaultTracker * )IoErr())
  523. *)
  524.  
  525. TYPE
  526.  
  527. (*
  528.  ************************************************************************
  529.  * The rlFirstItem list (ResList) is a list of TrackedResource (below)  *
  530.  * It is very important that nothing in this list depend on the task    *
  531.  * existing at resource freeing time (i.e., RemTask(0L) type stuff,     *
  532.  * DeletePort() and the rest).                                          *
  533.  *                                                                      *
  534.  * The tracking functions return a struct Tracker *Tracker to you, this *
  535.  * is a pointer to whatever follows the trID variable.                  *
  536.  * The default case is reflected below, and you get it if you call      *
  537.  * GetTracker() ( see DefaultTracker below).                            *
  538.  *                                                                      *
  539.  * NOTE: The two user variables mentioned in an earlier version don't   *
  540.  * exist, and never did. Sorry about that (SDB).                        *
  541.  *                                                                      *
  542.  * However, you can still use ArpAlloc() to allocate your own tracking  *
  543.  * nodes and they can be any size or shape you like, as long as the     *
  544.  * base structure is preserved. They will be freed automagically just   *
  545.  * like the default trackers.                                           *
  546.  ************************************************************************
  547.  *)
  548.  
  549.   TrackedResource * = RECORD
  550.     node *   : e.MinNode;      (* Double linked pointer                *)
  551.     flags *  : s.SET8;         (* Don't touch                          *)
  552.     lock *   : SYS.BYTE;       (* Don't touch, for Get/FreeAccess()    *)
  553.     id *     : INTEGER;        (* Item's ID                            *)
  554. (*
  555.  ************************************************************************
  556.  * The struct DefaultTracker *Tracker portion of the structure.         *
  557.  * The stuff below this point can conceivably vary, depending           *
  558.  * on user needs, etc.  This reflects the default.                      *
  559.  ************************************************************************
  560.  *)
  561.     object * : e.ADDRESS;
  562.     extra *  : e.ADDRESS;
  563.   END; (* TrackedResource *)
  564.  
  565.  
  566. TYPE
  567.  
  568. (*
  569.  ************************************************************************
  570.  * You get a pointer to a struct of the following type when you call    *
  571.  * GetTracker().  You can change this, and use ArpAlloc() instead of    *
  572.  * GetTracker() to do tracking. Of course, you have to take a wee bit   *
  573.  * more responsibility if you do, as well as if you use trakGeneric     *
  574.  * stuff.                                                               *
  575.  *                                                                      *
  576.  * trakGeneric folks need to set up a task function to be called when   *
  577.  * an item is freed.  Some care is required to set this up properly.    *
  578.  *                                                                      *
  579.  * Some special cases are indicated by the unions below, for            *
  580.  * trakWindow, if you have more than one window opened, and don't       *
  581.  * want the IDCMP closed particularly, you need to set a ptr to the     *
  582.  * other window in dtWindow2.  See CloseWindowSafely() for more info.   *
  583.  * If only one window, set this to NULL.                                *
  584.  ************************************************************************
  585.  *)
  586.  
  587.   DefaultTracker * = RECORD
  588.     object * : e.ADDRESS;
  589.     extra *  : e.ADDRESS;
  590.   END; (* DefaultTracker *)
  591.  
  592. CONST
  593.  
  594. (*
  595.  ************************************************************************
  596.  *      Items the tracker knows what to do about                        *
  597.  ************************************************************************
  598.  *)
  599.  
  600.   aAMem      * = 0;      (* Default (ArpAlloc) element           *)
  601.   lock       * = 1;      (* File lock                            *)
  602.   trFile     * = 2;      (* Opened file                          *)
  603.   window     * = 3;      (* Window -- see docs                   *)
  604.   screen     * = 4;      (* Screen                               *)
  605.   library    * = 5;      (* Opened library                       *)
  606.   dAMem      * = 6;      (* Pointer to DosAllocMem block         *)
  607.   memNode    * = 7;      (* AllocEntry() node                    *)
  608.   segList    * = 8;      (* Program segment                      *)
  609.   resList    * = 9;      (* ARP (nested) ResList                 *)
  610.   mem        * = 10;     (* Memory ptr/length                    *)
  611.   generic    * = 11;     (* Generic Element, your choice         *)
  612.   dAList     * = 12;     (* DAlist ( aka file request )          *)
  613.   anchor     * = 13;     (* Anchor chain (pattern matching)      *)
  614.   fReq       * = 14;     (* FileRequest struct                   *)
  615.   font       * = 15;     (* GfxBase CloseFont()                  *)
  616.   max        * = 15;     (* Poof, anything higher is tossed      *)
  617.  
  618.   unlink      * = 7;      (* Free node bit                        *)
  619.   reloc       * = 6;      (* This may be relocated (not used yet) *)
  620.   moved       * = 5;      (* Item moved                           *)
  621.  
  622.  
  623. TYPE
  624.  
  625. (*
  626.  ************************************************************************
  627.  * Note: ResList MUST be a DosAllocMem'ed list!, this is done for       *
  628.  * you when you call CreateTaskResList(), typically, you won't need     *
  629.  * to access/allocate this structure.                                   *
  630.  ************************************************************************
  631.  *)
  632.  
  633.   ResList * = RECORD
  634.     node *      : e.MinNode;  (* Used by arplib to link reslists      *)
  635.     taskID *    : e.TaskPtr;  (* Owner of this list                   *)
  636.     firstItem * : e.MinList;  (* List of Tracked Resources            *)
  637.     link *      : ResListPtr; (* SyncRun's use - hide list here       *)
  638.   END; (* ResList *)
  639.  
  640. CONST
  641.  
  642. (*
  643.  ************************************************************************
  644.  *      Returns from CompareLock()                                      *
  645.  ************************************************************************
  646.  *)
  647.  
  648.   equal       * = 0;   (* The two locks refer to the same object       *)
  649.   clVolume    * = 1;   (* Locks are on the same volume                 *)
  650.   difVol1     * = 2;   (* Locks are on different volumes               *)
  651.   difVol2     * = 3;   (* Locks are on different volumes               *)
  652.  
  653. TYPE
  654.  
  655. (*
  656.  ************************************************************************
  657.  *      ASyncRun() stuff...                                             *
  658.  ************************************************************************
  659.  * Message sent back on your request by an exiting process.             *
  660.  * You request this by putting the address of your message in           *
  661.  * pcbLastGasp, and initializing the ReplyPort variable of your         *
  662.  * ZombieMsg to the port you wish the message posted to.                *
  663.  ************************************************************************
  664.  *)
  665.  
  666.   ZombieMsg * = RECORD
  667.     execMessage * : e.Message;
  668.     taskNum *     : e.ULONG; (* Task ID                      *)
  669.     returnCode *  : LONGINT; (* Process's return code        *)
  670.     result2 *     : e.ULONG; (* System return code           *)
  671.     exitTime *    : d.Date;  (* Date stamp at time of exit   *)
  672.     userInfo *    : e.ULONG; (* For whatever you wish        *)
  673.   END; (* ZombieMsg *)
  674.  
  675. TYPE
  676.  
  677. (*
  678.  ************************************************************************
  679.  * Structure required by ASyncRun() -- see docs for more info.          *
  680.  ************************************************************************
  681.  *)
  682.  
  683.   ProcessControlBlock * = RECORD
  684.     stackSize * : e.ULONG;      (* Stacksize for new process                    *)
  685.     pri *       : SHORTINT;     (* Priority of new task                         *)
  686.     control *   : s.SET8;       (* Control bits, see defines below              *)
  687.     trapCode *  : e.ADDRESS;    (* Optional Trap Code                           *)
  688.     input *     : e.BPTR;
  689.     output *    : e.BPTR;       (* Optional stdin, stdout                       *)
  690.     console *   : LONGINT;
  691.     (* console is a union of:
  692.       splatFile * : e.BPTR;     (* File to use for Open("*")                    *)
  693.       conName *   : e.LSTRPTR;  (* CON: filename                                *)
  694.     *)
  695.     loadedCode * : e.ADDRESS;   (* If not null, will not load/unload code       *)
  696.     lastGasp *  : ZombieMsgPtr; (* ReplyMsg() to be filled in by exit           *)
  697.     wbProcess * : e.MsgPort;    (* Valid only when prNOCLI                    *)
  698.   END; (* ProcessControlBlock *)
  699.  
  700. CONST
  701.  
  702. (*
  703.  ************************************************************************
  704.  * Formerly needed to pass NULLCMD to a child.  No longer needed.       *
  705.  * It is being kept here for compatibility only...                      *
  706.  ************************************************************************
  707.  *)
  708.  
  709.   NoCmd   * = "\n";
  710.  
  711. CONST
  712.  
  713. (*
  714.  ************************************************************************
  715.  * The following control bits determine what ASyncRun() does on         *
  716.  * Abnormal Exits and on background process termination.                *
  717.  ************************************************************************
  718.  *)
  719.  
  720.   saveIO      * = 0;    (* Don't free/check file handles on exit        *)
  721.   closeSplat  * = 1;    (* Close Splat file, must request explicitly    *)
  722.   noCLI       * = 2;    (* Don't create a CLI process                   *)
  723. (*interactive * = 3;       This is now obsolete...                      *)
  724.   code        * = 4;    (* Dangerous yet enticing                       *)
  725.   stdio       * = 5;    (* Do the stdio thing, splat * = CON:Filename   *)
  726.  
  727.  
  728. CONST
  729.  
  730. (*
  731.  ************************************************************************
  732.  *      Error returns from SyncRun() and ASyncRun()                     *
  733.  ************************************************************************
  734.  *)
  735.  
  736.   noFile   * = -1;     (* Could not LoadSeg() the file                 *)
  737.   noMem    * = -2;     (* No memory for something                      *)
  738. (*noCLI      = -3;       This is now obsolete                          *)
  739.   noSlot   * = -4;     (* No room in TaskArray                         *)
  740.   noInput  * = -5;     (* Could not open input file                    *)
  741.   noOutput * = -6;     (* Could not get output file                    *)
  742. (*noLock     = -7;        This is now obsolete                         *)
  743. (*argErr     = -8;        This is now obsolete                         *)
  744. (*noBCPL     = -9;        This is now obsolete                         *)
  745. (*badLib     = -10;       This is now obsolete                         *)
  746.   noStdio  * = -11;    (* Couldn't get stdio handles                   *)
  747.  
  748. CONST
  749.  
  750. (*
  751.  ************************************************************************
  752.  *      Added V35 of arp.library                                        *
  753.  ************************************************************************
  754.  *)
  755.  
  756.   wantSMessage * = -12; (* Child wants you to report IoErr() to user    *)
  757.                           (* for SyncRun() only...                        *)
  758.   noShellProc  * = -13; (* Can't create a shell/cli process             *)
  759.   noExec       * = -14; (* 'E' bit is clear                             *)
  760.   script       * = -15; (* S and E are set, IoErr() contains directory  *)
  761.  
  762. TYPE
  763.  
  764. (*
  765.  ************************************************************************
  766.  * Version 35 ASyncRun() allows you to create an independent            *
  767.  * interactive or background Shell/CLi. You need this variant of the    *
  768.  * pcb structure to do it, and you also have new values for nshControl, *
  769.  * see below.                                                           *
  770.  *                                                                      *
  771.  * Syntax for Interactive shell is:                                     *
  772.  *                                                                      *
  773.  * rc=ASyncRun("Optional Window Name","Optional From File",&NewShell);  *
  774.  *                                                                      *
  775.  * Syntax for a background shell is:                                    *
  776.  *                                                                      *
  777.  * rc=ASyncRun("Command line",0L,&NewShell);                            *
  778.  *                                                                      *
  779.  * Same syntax for an Execute style call, but you have to be on drugs   *
  780.  * if you want to do that.                                              *
  781.  ************************************************************************
  782.  *)
  783.  
  784.   NewShell * = RECORD
  785.     stackSize * : e.ULONG;  (* stacksize shell will use for children        *)
  786.     pri *       : SHORTINT; (* ignored by interactive shells                *)
  787.     control *   : s.SET8;   (* bits/values: see above                       *)
  788.     logMsg *    : e.ADDRESS;(* Optional login message, if null, use default *)
  789.     input *     : e.BPTR;   (* ignored by interactive shells, but           *)
  790.     output *    : e.BPTR;   (* used by background and execute options.      *)
  791.     reserved *  : ARRAY 5 OF LONGINT;
  792.   END; (* NewShell *)
  793.  
  794. CONST
  795.  
  796. (*
  797.  ************************************************************************
  798.  * Bit Values for nshControl, you should use them as shown below, or    *
  799.  * just use the actual values indicated.                                *
  800.  ************************************************************************
  801.  *)
  802.  
  803.   cli         * = 0;      (* Do a CLI, not a shell        *)
  804.   backGround  * = 1;      (* Background shell             *)
  805.   execute     * = 2;      (* Do as EXECUTe...             *)
  806.   interactive * = 3;      (* Run an interactive shell     *)
  807.   fb          * = 7;      (* Alt function bit...          *)
  808.  
  809.  
  810. CONST
  811.  
  812. (*
  813.  ************************************************************************
  814.  *      Common values for shControl which allow you to do usefull      *
  815.  *      and somewhat "standard" things...                               *
  816.  ************************************************************************
  817.  *)
  818.  
  819.   interactiveShell * = { fb, interactive };         (* Gimme a newshell!            *)
  820.   interactiveCLI   * = { fb, interactive, cli };    (* Gimme that ol newcli!        *)
  821.   backgroundShell  * = { fb, backGround };          (* gimme a background shell     *)
  822.   executeMe        * = { fb, backGround, execute }; (* aptly named, doncha think?   *)
  823.  
  824. CONST
  825.  
  826. (*
  827.  ************************************************************************
  828.  *      Additional IoErr() returns added by ARP...                      *
  829.  ************************************************************************
  830.  *)
  831.  
  832.   errorBufferOverflow   * = 303;    (* User or internal buffer overflow     *)
  833.   errorBreak            * = 304;    (* A break character was received       *)
  834.   errorNotExecutable    * = 305;    (* A file has E bit cleared             *)
  835.   errorNotCLI           * = 400;    (* Program/function neeeds to be cli    *)
  836.  
  837. TYPE
  838.  
  839. (*
  840.  ************************************************************************
  841.  *      Resident Program Support                                        *
  842.  ************************************************************************
  843.  * This is the kind of node allocated for you when you AddResidentPrg() *
  844.  * a code segment.  They are stored as a single linked list with the    *
  845.  * root in ArpBase.  If you absolutely *must* wander through this list  *
  846.  * instead of using the supplied functions, then you must first obtain  *
  847.  * the semaphore which protects this list, and then release it          *
  848.  * afterwards.  Do not use Forbid() and Permit() to gain exclusive      *
  849.  * access!  Note that the supplied functions handle this locking        *
  850.  * protocol for you.                                                    *
  851.  ************************************************************************
  852.  *)
  853.  
  854.   ResidentProgramNode * = RECORD
  855.     next *      : ResidentProgramNodePtr; (* next or NULL        *)
  856.     usage *     : LONGINT;       (* Number of current users      *)
  857.     accessCnt * : e.UWORD;       (* Total times used...          *)
  858.     checkSum *  : e.ULONG;       (* Checksum of code             *)
  859.     segment *   : e.BPTR;        (* Actual segment               *)
  860.     flags *     : s.SET16;       (* See definitions below...     *)
  861.   (*name *      : ARRAY OF CHAR; (* Allocated as needed          *)*)
  862.   END; (* ResidentProgramNode *)
  863.  
  864. CONST
  865.  
  866. (*
  867.  ************************************************************************
  868.  *      Bit definitions for rpnFlags....                                *
  869.  ************************************************************************
  870.  *)
  871.  
  872.   noCheck * = 0;      (* Set in rpnFlags for no checksumming...      *)
  873.   cache *   = 1;      (* Private usage in v1.3...                    *)
  874.  
  875.  
  876. TYPE
  877.  
  878. (*
  879.  ************************************************************************
  880.  * If your program starts with this structure, ASyncRun() and SyncRun() *
  881.  * will override a users stack request with the value in rptStackSize.  *
  882.  * Furthermore, if you are actually attached to the resident list, a    *
  883.  * memory block of size rptDataSize will be allocated for you, and      *
  884.  * a pointer to this data passed to you in register A4.  You may use    *
  885.  * this block to clone the data segment of programs, thus resulting in  *
  886.  * one copy of text, but multiple copies of data/bss for each process   *
  887.  * invocation.  If you are resident, your program will start at         *
  888.  * rptInstruction, otherwise, it will be launched from the initial      *
  889.  * branch.                                                              *
  890.  ************************************************************************
  891.  *)
  892.  
  893.   ResidentProgramTag * = RECORD
  894.     nextSeg *   : e.BPTR;    (* Provided by DOS at LoadSeg time      *)
  895. (*
  896.  ************************************************************************
  897.  * The initial branch destination and rptInstruction do not have to be *
  898.  * the same.  This allows different actions to be taken if you are      *
  899.  * diskloaded or resident.  DataSize memory will be allocated only if   *
  900.  * you are resident, but StackSize will override all user stack         *
  901.  * requests.                                                            *
  902.  ************************************************************************
  903.  *)
  904.     bra *       : e.UWORD; (* Short branch to executable           *)
  905.     magic *     : e.UWORD; (* Resident majik value                 *)
  906.     stackSize * : e.ULONG; (* min stack for this process           *)
  907.     dataSize *  : e.ULONG; (* Data size to allocate if resident    *)
  908.     (*      instruction;        Start here if resident          *)
  909.   END; (* ResidentProgramTag *)
  910.  
  911. TYPE
  912.  
  913. (*
  914.  ************************************************************************
  915.  * The form of the ARP allocated node in your tasks memlist when        *
  916.  * launched as a resident program. Note that the data portion of the    *
  917.  * node will only exist if you have specified a nonzero value for       *
  918.  * rptDataSize. Note also that this structure is READ ONLY, modify     *
  919.  * values in this at your own risk.  The stack stuff is for tracking,   *
  920.  * if you need actual addresses or stack size, check the normal places  *
  921.  * for it in your process/task struct.                                  *
  922.  ************************************************************************
  923.  *)
  924.  
  925.   ProcessMemory * = RECORD
  926.     node *      : e.Node;
  927.     num *       : e.UWORD; (* This is 1 if no data, two if data    *)
  928.     stack *     : e.APTR;
  929.     stackSize * : e.ULONG;
  930.     data *      : e.APTR;  (* Only here if pmNum == 2              *)
  931.     dataSize *  : e.ULONG;
  932.   END; (* ProcessMemory *)
  933.  
  934. CONST
  935.  
  936. (*
  937.  ************************************************************************
  938.  * To find the above on your memlist, search for the following name.    *
  939.  * We guarantee this will be the only arp.library allocated node on     *
  940.  * your memlist with this name.                                         *
  941.  * i.e. FindName(task->tcbMemEntry, pmemNAME);                        *
  942.  ************************************************************************
  943.  *)
  944.  
  945.   pMemName       * = "ARP_MEM";
  946.  
  947.   residentMagic  * = 4AFCH;          (* same as rtcMATCHWORD (trapf) *)
  948.  
  949. TYPE
  950.  
  951. (*
  952.  ************************************************************************
  953.  *      Date String/Data structures                                     *
  954.  ************************************************************************
  955.  *)
  956.  
  957.   DateTime * = RECORD
  958.     stamp *   : d.Date;     (* DOS Datestamp                        *)
  959.     format *  : SYS.BYTE;   (* controls appearance ot datStrDate    *)
  960.     flags *   : s.SET8;     (* See BITDEF's below                   *)
  961.     strDay *  : e.ADDRESS;  (* day of the week string               *)
  962.     strDate * : e.ADDRESS;  (* date string                          *)
  963.     strTime * : e.ADDRESS;  (* time string                          *)
  964.   END; (* DateTime *)
  965.  
  966. CONST
  967.  
  968. (*
  969.  ************************************************************************
  970.  *      Size of buffer you need for each DateTime strings:              *
  971.  ************************************************************************
  972.  *)
  973.  
  974.   lenDatString   * = 10;
  975.  
  976. CONST
  977.  
  978. (*
  979.  ************************************************************************
  980.  *      For datFlags                                                   *
  981.  ************************************************************************
  982.  *)
  983.  
  984.   subSt  * = 0; (* Substitute "Today" "Tomorrow" where appropriate      *)
  985.   future * = 1; (* Day of the week is in future                         *)
  986.  
  987.  
  988. CONST
  989.  
  990. (*
  991.  ************************************************************************
  992.  *      For datFormat                                                  *
  993.  ************************************************************************
  994.  *)
  995.  
  996.   formatDos * = 0;         (* dd-mmm-yy AmigaDOS's own, unique style               *)
  997.   formatInt * = 1;         (* yy-mm-dd International format                        *)
  998.   formatUSA * = 2;         (* mm-dd-yy The good'ol'USA.                            *)
  999.   formatCDN * = 3;         (* dd-mm-yy Our brothers and sisters to the north       *)
  1000.   formatMAX * = formatCDN; (* Larger than this? Defaults to AmigaDOS               *)
  1001.  
  1002.  
  1003. (* --- Library Base variable -------------------------------------------- *)
  1004.  
  1005.  
  1006. VAR
  1007.  
  1008.   arp *, base *  : ArpBasePtr;
  1009.  
  1010.  
  1011. (* --- Library Functions ------------------------------------------------ *)
  1012.  
  1013. TYPE
  1014.  
  1015.   PROC * = PROCEDURE();
  1016.  
  1017. (*
  1018.  ************************************************************************
  1019.  *  These duplicate the calls in dos.library                            *
  1020.  *  Only include if you can use arp.library without dos.library         *
  1021.  ************************************************************************
  1022.  *)
  1023.  
  1024.  
  1025. PROCEDURE Open* [base,-30]
  1026.   ( name       [1] : ARRAY OF CHAR;
  1027.     accessMode [2] : LONGINT)
  1028.   : d.FileHandlePtr;
  1029. PROCEDURE Close* [base,-36]
  1030.   ( file [1] : d.FileHandlePtr );
  1031. PROCEDURE Read* [base,-42]
  1032.   ( file       [1] : d.FileHandlePtr;
  1033.     VAR buffer [2] : ARRAY OF SYS.BYTE;
  1034.     length     [3] : LONGINT)
  1035.   : LONGINT;
  1036. PROCEDURE Write* [base,-48]
  1037.   ( file   [1] : d.FileHandlePtr;
  1038.     buffer [2] : ARRAY OF SYS.BYTE;
  1039.     length [3] : LONGINT)
  1040.   : LONGINT;
  1041. PROCEDURE Input* [base,-54] ()
  1042.   : d.FileHandlePtr;
  1043. PROCEDURE Output* [base,-60] ()
  1044.   : d.FileHandlePtr;
  1045. PROCEDURE Seek* [base,-66]
  1046.   ( file     [1] : d.FileHandlePtr;
  1047.     position [2] : LONGINT;
  1048.     offset   [3] : LONGINT)
  1049.   : LONGINT;
  1050. PROCEDURE DeleteFile* [base,-72]
  1051.   ( name [1] : ARRAY OF CHAR )
  1052.   : BOOLEAN;
  1053. PROCEDURE Rename* [base,-78]
  1054.   ( oldName [1] : ARRAY OF CHAR;
  1055.     newName [2] : ARRAY OF CHAR )
  1056.   : BOOLEAN;
  1057. PROCEDURE Lock* [base,-84]
  1058.   ( name [1] : ARRAY OF CHAR;
  1059.     type [2] : LONGINT)
  1060.   : d.FileLockPtr;
  1061. PROCEDURE UnLock* [base,-90]
  1062.   ( lock [1] : d.FileLockPtr );
  1063. PROCEDURE DupLock* [base,-96]
  1064.   ( lock [1] : d.FileLockPtr )
  1065.   : d.FileLockPtr;
  1066. PROCEDURE Examine* [base,-102]
  1067.   ( lock          [1] : d.FileLockPtr;
  1068.     fileInfoBlock [2] : d.FileInfoBlockPtr )
  1069.   : BOOLEAN;
  1070. PROCEDURE ExNext* [base,-108]
  1071.   ( lock          [1] : d.FileLockPtr;
  1072.     fileInfoBlock [2] : d.FileInfoBlockPtr )
  1073.   : BOOLEAN;
  1074. PROCEDURE Info* [base,-114]
  1075.   ( lock           [1] : d.FileLockPtr;
  1076.     parameterBlock [2] : d.InfoDataPtr )
  1077.   : BOOLEAN;
  1078. PROCEDURE CreateDir* [base,-120]
  1079.   ( name [1] : ARRAY OF CHAR )
  1080.   : d.FileLockPtr;
  1081. PROCEDURE CurrentDir* [base,-126]
  1082.   ( lock [1] : d.FileLockPtr )
  1083.   : d.FileLockPtr;
  1084. PROCEDURE IoErr* [base,-132] ()
  1085.   : LONGINT;
  1086. PROCEDURE CreateProc* [base,-138]
  1087.   ( name      [1] : ARRAY OF CHAR;
  1088.     pri       [2] : LONGINT;
  1089.     segList   [3] : e.BPTR;
  1090.     stackSize [4] : LONGINT)
  1091.   : e.MsgPortPtr;
  1092. PROCEDURE Exit* [base,-144]
  1093.   ( returnCode [1] : LONGINT);
  1094. PROCEDURE LoadSeg* [base,-150]
  1095.   ( name [1] : ARRAY OF CHAR )
  1096.   : e.BPTR;
  1097. PROCEDURE UnLoadSeg* [base,-156]
  1098.   ( seglist [1] : e.BPTR );
  1099. PROCEDURE DeviceProc* [base,-174]
  1100.   ( name [1] : ARRAY OF CHAR )
  1101.   : e.MsgPortPtr;
  1102. PROCEDURE SetComment* [base,-180]
  1103.   ( name    [1] : ARRAY OF CHAR;
  1104.     comment [2] : ARRAY OF CHAR )
  1105.   : BOOLEAN;
  1106. PROCEDURE SetProtection* [base,-186]
  1107.   ( name    [1] : ARRAY OF CHAR;
  1108.     protect [2] : s.SET32)
  1109.   : BOOLEAN;
  1110. PROCEDURE DateStamp* [base,-192]
  1111.   ( VAR date [1] : d.DateBase );
  1112. PROCEDURE Delay* [base,-198]
  1113.   ( timeout [1] : e.ULONG);
  1114. PROCEDURE WaitForChar* [base,-204]
  1115.   ( file    [1] : d.FileHandlePtr;
  1116.     timeout [2] : LONGINT)
  1117.   : BOOLEAN;
  1118. PROCEDURE ParentDir* [base,-210]
  1119.   ( lock [1] : d.FileLockPtr )
  1120.   : d.FileLockPtr;
  1121. PROCEDURE IsInteractive* [base,-216]
  1122.   ( file [1] : d.FileHandlePtr )
  1123.   : BOOLEAN;
  1124. PROCEDURE Execute* [base,-222]
  1125.   ( string [1] : ARRAY OF CHAR;
  1126.     file   [2] : d.FileHandlePtr;
  1127.     file2  [3] : d.FileHandlePtr )
  1128.   : LONGINT;
  1129.  
  1130.  
  1131. (*
  1132.  ************************************************************************
  1133.  * Now for the stuff that only exists in arp.library...                 *
  1134.  ************************************************************************
  1135.  *)
  1136.  
  1137. PROCEDURE VPrintf* [base,-228]
  1138.   ( string [8] : ARRAY OF CHAR;
  1139.     args   [9] : ARRAY OF e.ADDRESS )
  1140.   : LONGINT;
  1141. PROCEDURE Printf* [base,-228]
  1142.   ( string [8]  : ARRAY OF CHAR;
  1143.     args   [9]..: e.APTR )
  1144.   : LONGINT;
  1145. PROCEDURE VFPrintf* [base,-234]
  1146.   ( file   [0] : d.FileHandlePtr;
  1147.     string [8] : ARRAY OF CHAR;
  1148.     args   [9] : ARRAY OF e.APTR )
  1149.   : LONGINT;
  1150. PROCEDURE FPrintf* [base,-234]
  1151.   ( file   [0]  : d.FileHandlePtr;
  1152.     string [8]  : ARRAY OF CHAR;
  1153.     args   [9]..: e.APTR )
  1154.   : LONGINT;
  1155. PROCEDURE Puts* [base,-240]
  1156.   ( string [9] : ARRAY OF CHAR )
  1157.   : LONGINT;
  1158. PROCEDURE ReadLine* [base,-246]
  1159.   ( VAR string [8] : ARRAY OF CHAR )
  1160.   : LONGINT;
  1161. PROCEDURE GADS* [base,-252]
  1162.   ( line      [8] : ARRAY OF CHAR;
  1163.     len       [0] : LONGINT;
  1164.     help      [9] : e.ADDRESS;
  1165.     VAR args [10] : ARRAY OF SYS.LONGWORD;
  1166.     temp     [11] : ARRAY OF CHAR )
  1167.   : LONGINT;
  1168. PROCEDURE Atol* [base,-258]
  1169.   ( string [8] : ARRAY OF CHAR )
  1170.   : LONGINT;
  1171. PROCEDURE EscapeString* [base,-264]
  1172.   ( string [8] : ARRAY OF CHAR )
  1173.   : e.ULONG;
  1174. PROCEDURE CheckAbort* [base,-270]
  1175.   ( func [9] : e.PROC )
  1176.   : LONGINT;
  1177. PROCEDURE CheckBreak* [base,-276]
  1178.   ( mask [1] : s.SET32;
  1179.     func [9] : e.PROC )
  1180.   : LONGINT;
  1181. PROCEDURE Getenv* [base,-282]
  1182.   ( string     [8] : ARRAY OF CHAR;
  1183.     VAR buffer [9] : ARRAY OF CHAR;
  1184.     size       [0] : LONGINT )
  1185.   : e.ADDRESS;
  1186. PROCEDURE Setenv* [base,-288]
  1187.   ( varName [8] : ARRAY OF CHAR;
  1188.     value   [9] : ARRAY OF CHAR )
  1189.   : BOOLEAN;
  1190. PROCEDURE FileRequest* [base,-294]
  1191.   ( VAR fileRequester [8] : FileRequester )
  1192.   : e.ADDRESS;
  1193. PROCEDURE CloseWindowSafely* [base,-300]
  1194.   ( window      [8] : i.WindowPtr;
  1195.     moreWindows [9] : i.WindowPtr );
  1196. PROCEDURE CreatePort* [base,-306]
  1197.   ( name [8] : ARRAY OF CHAR;
  1198.     pri  [0] : LONGINT )
  1199.   : e.MsgPortPtr;
  1200. PROCEDURE DeletePort* [base,-312]
  1201.   ( port [9] : e.MsgPortBasePtr );
  1202. PROCEDURE SendPacket* [base,-318]
  1203.   ( action  [0] : LONGINT;
  1204.     args    [8] : e.ADDRESS;
  1205.     handler [9] : e.MsgPortBasePtr )
  1206.   : LONGINT;
  1207. PROCEDURE InitStdPacket* [base,-324]
  1208.   ( action     [0] : LONGINT;
  1209.     args       [8] : e.ADDRESS;
  1210.     packet     [9] : d.DosPacketPtr;
  1211.     replyPort [10] : e.MsgPortBasePtr );
  1212. PROCEDURE PathName* [base,-330]
  1213.   ( lock           [0] : d.FileLockPtr;
  1214.     VAR buffer     [8] : ARRAY OF CHAR;
  1215.     componentCount [1] : LONGINT )
  1216.   : e.ULONG;
  1217. PROCEDURE Assign* [base,-336]
  1218.   ( logical  [8] : ARRAY OF CHAR;
  1219.     physical [9] : ARRAY OF CHAR )
  1220.   : e.ULONG;
  1221. PROCEDURE DosAllocMem* [base,-342]
  1222.   ( size [0] : LONGINT )
  1223.   : e.APTR;
  1224. PROCEDURE DosFreeMem* [base,-348]
  1225.   ( block [9] : e.APTR );
  1226. PROCEDURE BtoCStr* [base,-354]
  1227.   ( VAR cstr  [8] : ARRAY OF CHAR;
  1228.     bstr      [0] : d.BSTR;
  1229.     maxLength [1] : LONGINT )
  1230.   : e.ULONG;
  1231. PROCEDURE CtoBStr* [base,-360]
  1232.   ( cstr      [8] : ARRAY OF CHAR;
  1233.     VAR bstr  [0] : d.BSTR;
  1234.     maxLength [1] : LONGINT )
  1235.   : e.ULONG;
  1236. PROCEDURE GetDevInfo* [base,-366]
  1237.   ( devNode [10] : d.DeviceListPtr )
  1238.   : d.DeviceListPtr;
  1239. PROCEDURE FreeTaskResList* [base,-372] ()
  1240.   : BOOLEAN;
  1241. PROCEDURE ArpExit* [base,-378]
  1242.   ( rc    [0] : LONGINT;
  1243.     fault [2] : LONGINT );
  1244. PROCEDURE ArpAlloc* [base,-384]
  1245.   ( size [0] : LONGINT )
  1246.   : e.ADDRESS;
  1247. PROCEDURE ArpAllocMem* [base,-390]
  1248.   ( size         [0] : LONGINT;
  1249.     requirements [1] : s.SET32 )
  1250.   : e.ADDRESS;
  1251. PROCEDURE ArpOpen* [base,-396]
  1252.   ( name [1] : ARRAY OF CHAR;
  1253.     mode [2] : LONGINT )
  1254.   : d.FileHandlePtr;
  1255. PROCEDURE ArpDupLock* [base,-402]
  1256.   ( lock [1] : d.FileLockPtr )
  1257.   : d.FileLockPtr;
  1258. PROCEDURE ArpLock* [base,-408]
  1259.   ( name [1] : ARRAY OF CHAR;
  1260.     mode [2] : LONGINT )
  1261.   : d.FileLockPtr;
  1262. PROCEDURE RListAlloc* [base,-414]
  1263.   ( resList [8] : ResListPtr;
  1264.     size    [0] : LONGINT )
  1265.   : e.ADDRESS;
  1266. PROCEDURE FindCLI* [base,-420]
  1267.   ( cliNum [0] : LONGINT )
  1268.   : e.APTR;
  1269. PROCEDURE QSort* [base,-426]
  1270.   ( data  [8] : e.APTR;
  1271.     rSize [0] : LONGINT;
  1272.     bSize [1] : LONGINT;
  1273.     comp  [9] : e.PROC )
  1274.   : BOOLEAN;
  1275. PROCEDURE PatternMatch* [base,-432]
  1276.   ( pattern [8] : ARRAY OF CHAR;
  1277.     string  [9] : ARRAY OF CHAR )
  1278.   : BOOLEAN;
  1279. PROCEDURE FindFirst* [base,-438]
  1280.   ( pattern  [0] : ARRAY OF CHAR;
  1281.     VAR path [8] : AnchorPath )
  1282.   : LONGINT;
  1283. PROCEDURE FindNext* [base,-444]
  1284.   ( VAR path [8] : AnchorPath )
  1285.   : LONGINT;
  1286. PROCEDURE FreeAnchorChain* [base,-450]
  1287.   ( VAR path [8] : AnchorPath );
  1288. PROCEDURE CompareLock* [base,-456]
  1289.   ( lock1 [0] : d.FileLockPtr;
  1290.     lock2 [1] : d.FileLockPtr )
  1291.   : e.ULONG;
  1292. PROCEDURE FindTaskResList* [base,-462] ()
  1293.   : ResListPtr;
  1294. PROCEDURE CreateTaskResList* [base,-468] ()
  1295.   : ResListPtr;
  1296. PROCEDURE FreeResList* [base,-474]
  1297.   ( freeList [9] : ResListPtr );
  1298. PROCEDURE FreeTrackedItem* [base,-480]
  1299.   ( item [9] : DefaultTrackerPtr );
  1300. PROCEDURE GetTracker* [base,-486]
  1301.   ( size [9] : LONGINT )
  1302.   : DefaultTrackerPtr;
  1303. PROCEDURE GetAccess* [base,-492]
  1304.   ( tracker [9] : DefaultTrackerPtr )
  1305.   : e.APTR;
  1306. PROCEDURE FreeAccess* [base,-498]
  1307.   ( tracker [9] : DefaultTrackerPtr );
  1308. PROCEDURE FreeDAList* [base,-504]
  1309.   ( VAR node [9] : DirectoryEntry );
  1310. PROCEDURE AddDANode* [base,-510]
  1311.   ( data       [8] : ARRAY OF CHAR;
  1312.     VAR daList [9] : DirectoryEntry;
  1313.     length     [0] : LONGINT;
  1314.     id         [1] : LONGINT )
  1315.   : DirectoryEntryPtr;
  1316. PROCEDURE AddDADevs* [base,-516]
  1317.   ( VAR daList [8] : DirectoryEntry;
  1318.     select     [0] : s.SET32 )
  1319.   : e.ULONG;
  1320. PROCEDURE Strcmp* [base,-522]
  1321.   ( s1 [8] : ARRAY OF CHAR;
  1322.     s2 [9] : ARRAY OF CHAR )
  1323.   : LONGINT;
  1324. PROCEDURE Strncmp* [base,-528]
  1325.   ( s1     [8] : ARRAY OF CHAR;
  1326.     s2     [9] : ARRAY OF CHAR;
  1327.     length [0] : LONGINT )
  1328.   : LONGINT;
  1329. PROCEDURE ToUpper* [base,-534]
  1330.   ( char [0] : CHAR )
  1331.   : CHAR;
  1332. PROCEDURE SyncRun* [base,-540]
  1333.   ( name    [8] : ARRAY OF CHAR;
  1334.     command [9] : e.ADDRESS;
  1335.     input   [0] : d.FileHandlePtr;
  1336.     output  [1] : d.FileHandlePtr )
  1337.   : LONGINT;
  1338.  
  1339. (*
  1340.  ************************************************************************
  1341.  *  Added V32 of arp.library                                            *
  1342.  ************************************************************************
  1343.  *)
  1344.  
  1345. PROCEDURE ASyncRun* [base,-546]
  1346.   ( name     [8] : ARRAY OF CHAR;
  1347.     command  [9] : e.ADDRESS;
  1348.     VAR pcb [10] : ProcessControlBlock )
  1349.   : LONGINT;
  1350. PROCEDURE SpawnShell* [base,-546]
  1351.   ( name       [8] : ARRAY OF CHAR;
  1352.     command    [9] : e.ADDRESS;
  1353.     VAR shell [10] : NewShell )
  1354.   : LONGINT;
  1355. PROCEDURE LoadPrg* [base,-552]
  1356.   ( name [1] : ARRAY OF CHAR )
  1357.   : e.BPTR;
  1358. PROCEDURE PreParse* [base,-558]
  1359.   ( source   [8] : ARRAY OF CHAR;
  1360.     VAR dest [9] : ARRAY OF CHAR )
  1361.   : BOOLEAN;
  1362.  
  1363. (*
  1364.  ************************************************************************
  1365.  * Added V33 of arp.library                                             *
  1366.  ************************************************************************
  1367.  *)
  1368.  
  1369. PROCEDURE StamptoStr* [base,-564]
  1370.   ( VAR dateTime [8] : DateTime )
  1371.   : BOOLEAN;
  1372. PROCEDURE StrtoStamp* [base,-570]
  1373.   ( VAR dateTime [8] : DateTime )
  1374.   : BOOLEAN;
  1375. PROCEDURE ObtainResidentPrg* [base,-576]
  1376.   ( name [8] : ARRAY OF CHAR )
  1377.   : ResidentProgramNodePtr;
  1378. PROCEDURE AddResidentPrg* [base,-582]
  1379.   ( segment [1] : e.BPTR;
  1380.     name    [8] : ARRAY OF CHAR )
  1381.   : ResidentProgramNodePtr;
  1382. PROCEDURE RemResidentPrg* [base,-588]
  1383.   ( name [8] : ARRAY OF CHAR )
  1384.   : LONGINT;
  1385. PROCEDURE UnLoadPrg* [base,-594]
  1386.   ( segment [1] : e.BPTR );
  1387. PROCEDURE LMult* [base,-600]
  1388.   ( a [0] : LONGINT;
  1389.     b [1] : LONGINT )
  1390.   : LONGINT;
  1391. PROCEDURE LDiv* [base,-606]
  1392.   ( a [0] : LONGINT;
  1393.     b [1] : LONGINT )
  1394.   : LONGINT;
  1395. PROCEDURE LMod* [base,-612]
  1396.   ( a [0] : LONGINT;
  1397.     b [1] : LONGINT )
  1398.   : LONGINT;
  1399. PROCEDURE CheckSumPrg* [base,-618]
  1400.   ( VAR node [0] : ResidentProgramNode )
  1401.   : e.ULONG;
  1402. PROCEDURE TackOn* [base,-624]
  1403.   ( VAR pathname [8] : ARRAY OF CHAR;
  1404.     filename     [9] : ARRAY OF CHAR );
  1405. PROCEDURE BaseName* [base,-630]
  1406.   ( name [8] : ARRAY OF CHAR )
  1407.   : e.ADDRESS;
  1408. PROCEDURE ReleaseResidentPrg* [base,-636]
  1409.   ( segment [1] : e.BPTR )
  1410.   : ResidentProgramNodePtr;
  1411.  
  1412. (*
  1413.  ************************************************************************
  1414.  * Added V36 of arp.library                                             *
  1415.  ************************************************************************
  1416.  *)
  1417.  
  1418. PROCEDURE SPrintf* [base,-642]
  1419.   ( file   [0] : e.ADDRESS;
  1420.     string [8] : ARRAY OF CHAR;
  1421.     stream [9] : e.ADDRESS )
  1422.   : LONGINT;
  1423. PROCEDURE GetKeywordIndex* [base,-648]
  1424.   ( key      [8] : ARRAY OF CHAR;
  1425.     template [9] : ARRAY OF CHAR )
  1426.   : LONGINT;
  1427. PROCEDURE ArpOpenLibrary* [base,-654]
  1428.   ( name    [9] : ARRAY OF CHAR;
  1429.     version [0] : LONGINT )
  1430.   : e.LibraryPtr;
  1431. PROCEDURE ArpAllocFreq* [base,-660] ()
  1432.   : FileRequesterPtr;
  1433.  
  1434.  
  1435. (* --- Library Base variable -------------------------------------------- *)
  1436. <*$LongVars-*>
  1437.  
  1438. (*------------------------------------*)
  1439. PROCEDURE* [0] CloseLib (VAR rc : LONGINT);
  1440.  
  1441. BEGIN (* CloseLib *)
  1442.   IF base # NIL THEN e.CloseLibrary (base) END
  1443. END CloseLib;
  1444.  
  1445. BEGIN (* ARP *)
  1446.   base := SYS.VAL (ArpBasePtr,
  1447.                    e.OpenLibrary (arpName, arpVersion));
  1448.   IF base = NIL THEN HALT (100) END;
  1449.   arp := base; Kernel.SetCleanup (CloseLib)
  1450. END ARP.
  1451.